package com.onlyxiahui.common.action.description.handler.impl.title;

import com.onlyxiahui.common.action.description.DocumentContext;
import com.onlyxiahui.common.action.description.annotation.DocModule;
import com.onlyxiahui.common.action.description.handler.ModuleTitleHandler;

/**
 * Description <br>
 * Date 2020-01-08 08:46:54<br>
 * 
 * @author XiaHui [onlovexiahui@qq.com]<br>
 * @since 1.0.0
 */

public class ModuleDefineTitleHandler implements ModuleTitleHandler {

	@Override
	public boolean support(DocumentContext context, Class<?> classType, String text) {
		boolean hasModuleDefine = null != classType.getAnnotation(DocModule.class);
		return hasModuleDefine;
	}

	@Override
	public String handle(DocumentContext context, Class<?> classType, String text) {
		DocModule md = classType.getAnnotation(DocModule.class);
		return md.title();
	}
}
